package com.jd.mapper;

import com.jd.entity.School;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

import java.util.List;

public interface SchoolMapper {
    @Select("select * from school;")
    List<School> getAllSchools();
    @Select(" select * from school where schoolName like '%${schoolName}%'; ")
    List<School> getSchoolByName(String schoolName);
    @Select("select * from school where schoolId =#{id};")

    School getSchoolById(int id);
    @Delete(" delete  from school where schoolId = #{id}")
    int deleteSchoolById(int id);
    @Insert("insert into school (schoolName, schoolAddress, schoolPhone) values (#{schoolName},#{schoolAddress},#{schoolPhone}) ;")
   int insertSchool(School school);
   @Update("update  school set schoolName =#{schoolName},schoolAddress=#{schoolAddress},schoolPhone=#{schoolPhone} where schoolId=#{schoolId}")
    int updateSchool(School school);

}
